//
//  GHBaseCollectionViewController.swift
//  KYC2C
//
//  Created by Guanghui Liao on 12/15/17.
//  Copyright © 2017 liaoworking. All rights reserved.
//

import UIKit
import DZNEmptyDataSet
class GHBaseCollectionViewController: GHBaseViewController,UICollectionViewDataSource,UICollectionViewDelegate {

    //MARK: -lazy
    var flowLayout:UICollectionViewFlowLayout = UICollectionViewFlowLayout()
    
    var dataList:Array<Any> = []
    
    lazy var collectionView:UICollectionView = {() -> UICollectionView in
        var collectionView = UICollectionView(frame: UIScreen.main.bounds, collectionViewLayout: flowLayout)
        collectionView.delegate = self as UICollectionViewDelegate
        collectionView.dataSource = self as UICollectionViewDataSource
        collectionView.emptyDataSetSource = self
        view.addSubview(collectionView)
        return collectionView
    }()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    

    //MARK: - collectionViewDelegate and delegate
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return self.dataList.count;
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        return UICollectionViewCell()
    }
  
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}


extension GHBaseCollectionViewController:DZNEmptyDataSetSource {
    
    public func title(forEmptyDataSet scrollView: UIScrollView!) -> NSAttributedString! {
        
        let MAString = NSAttributedString(string: "暂无数据", attributes: [NSAttributedStringKey.font:UIFont.systemFont(ofSize: 17),NSAttributedStringKey.foregroundColor:UIColor.init(red: 104, green: 164, blue: 237) ?? UIColor.black])
        return MAString
    }
    
    
    public func image(forEmptyDataSet scrollView: UIScrollView!) -> UIImage! {
        return  #imageLiteral(resourceName: "不限次数")
    }
    
}
